import request from '@/utils/request'

// 货区供货商列表
export function getList() {
  return request({
    url: '/PB/PB_Supplier/QueryDataList',
    method: 'post',
    data: {
      PageIndex: 1,
      PageRows: 10
    }
  })
}
// 新建供应商
export function addGongying(data) {
  return request({
    url: '/PB/PB_Supplier/SaveData',
    method: 'post',
    data
  })
}
// 删除供应商
export function delGongying(data) {
  return request({
    url: '/PB/PB_Supplier/DeleteData',
    method: 'post',
    data
  })
}
// 查询供应商
export function getGongying(data) {
  return request({
    url: '/PB/PB_Supplier/QueryDataList',
    method: 'post',
    data: {
      PageIndex: 1,
      PageRows: 10,
      Search: {
        KeyWord: data.ZY_sousuo,
        Type: data.SS_xialia
      }
    }
  })
}

// 获取供货商详细信息
export function getGongyingDetail(data) {
  return request({
    url: '/PB/PB_Supplier/GetTheData',
    method: 'post',
    data
  })
}
// 获取地址详细
export function getAddress(data) {
  return request({
    url: '/PB/PB_Address/QueryDataList',
    method: 'post',
    data: {
      PageIndex: 1,
      PageRows: 10,
      Search: {
        CusId: '',
        SupId: data
      },
      SortField: 'Id',
      SortType: 'asc'
    }
  })
}

// 更改地址的状态（停用/启用）
export function changeStatus(id) {
  return request({
    url: `/PB/PB_Address/ModifyEnable?id=${id}`,
    method: 'post'
  })
}
// 更改地址的默认（开/关）
export function morenStatus(id) {
  return request({
    url: `/PB/PB_Address/ModifyDefault?id=${id}`,
    method: 'post'
  })
}

// 新增地址
export function addAddress(data) {
  return request({
    url: '/PB/PB_Address/SaveData',
    method: 'post',
    data
  })
}
// 删除地址
export function delAddress(data) {
  return request({
    url: `/PB/PB_Address/DeleteData`,
    method: 'post',
    data
  })
}
export function BianJidizhi(data) {
  return request({
    url: '/PB/PB_Address/GetTheData',
    method: 'post',
    data
  })
}
